package org.zk.dubbo_provider.service.impl;



import org.zk.dubbo_provider.dao.OrderMapper;
import org.zk.entity.Order;
import org.zk.service.OrderService;
import com.alibaba.dubbo.config.annotation.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Alicelonely
 * @since 2019-12-11
 */
@Service(timeout = 10000)
public class OrderServiceImpl   implements OrderService {

    @Resource
    OrderMapper orderMapper;


    //高申 2019-12-16 根据用户id和课程id判断用户是否购买过该课程
    @Override
    public int queryUserOrder(Map map) {
        return orderMapper.queryUserOrder(map);
    }

    //高申 2019-12-16 用户下单,生成订单操作
    @Override
    public void insertcreateOrder(Order order) {
        orderMapper.createOrder(order);
    }

    //高申 2019-12-17 根据订单id查看订单详情
    @Override
    public Order queryOneOrder(String orderId) {
        return orderMapper.queryOneOrder(orderId);
    }

    @Override
    public void updateOrder(Order order) {
        orderMapper.updateOrder(order);
    }
    //根据用户Id查询订单
    @Override
    public List<Order> getOrder(int userId) {
        return orderMapper.getOrder(userId);
    }

    @Override
    public void delOrder(int orderId) {
        orderMapper.delOrder(orderId);
    }

    //教师个人中心收支明细
    @Override
    public List<Map> queryShouRu(Map<String, Object> map) {
        return orderMapper.queryShouRu(map);
    }
    //教师个人中心收支明细（含非会员购买次数）
    @Override
    public List<Map> queryShouRuU(Map<String, Object> map) {
        return orderMapper.queryShouRuU(map);
    }

    //查询单门课程在一定时间内普通用户的购买次数
    @Override
    public int queryUserOrderCount(Map<String, Object> map) {
        return orderMapper.queryUserOrderCount(map);
    }

    @Override
    public int queryUserBroadcastOrder(Map map) {
        return orderMapper.queryUserBroadcastOrder(map);
    }

    @Override
    public Order queryOneBroadcastOrder(String orderId) {
        return orderMapper.queryOneBroadcastOrder(orderId);
    }


    //创建Vip订单（刘硕）
    @Override
    public void insertcreateVipOrder(Order order) {
        orderMapper.createVipOrder(order);
    }
    //查询Vip订单（刘硕）
    @Override
    public Order queryVipOrder(String orderId) {
        return orderMapper.queryVipOrder(orderId);
    }
    public OrderMapper getOrderMapper() {
        return orderMapper;
    }

    public void setOrderMapper(OrderMapper orderMapper) {
        this.orderMapper = orderMapper;
    }
}
